import request from '@/utils/http'

const baseUrl = process.env.VUE_APP_JAVA_URL

const combineUrl = function (url) {
  return baseUrl + url
}
const userApi = {
  Login: combineUrl('/user/login'),
  sendSms: combineUrl('/user/getShortMsg'),
  groupInfo: combineUrl('/group/getGroupInfoByUserId'),
  resourceList: combineUrl('/resource/getResourceListByUserId'),
  roleInfo: combineUrl('/role/getRoleInfoByUserId'),
  group: combineUrl('/group/getGroupInfoByGroupCode ')
}

export function login (parameter) {
  return request({
    url: userApi.Login,
    method: 'post',
    data: parameter
  })
}

export function getSmsCaptcha (parameter) {
  return request({
    url: userApi.sendSms,
    method: 'post',
    data: parameter
  })
}

export function getGroupInfo (parameter) {
  return request({
    url: userApi.groupInfo,
    method: 'post',
    data: parameter
  })
}
export function getResourceList (parameter) {
  return request({
    url: userApi.resourceList,
    method: 'post',
    data: parameter
  })
}

export function getRoleInfo (parameter) {
  return request({
    url: userApi.roleInfo,
    method: 'post',
    data: parameter
  })
}

export function getGroup (parameter) {
  return request({
    url: userApi.group,
    method: 'post',
    data: parameter
  })
}
